/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DataConverters.interfaces.dataformulaobject.impl;

import DataConverters.interfaces.dataformulaobject.intefaces.Cell;
import DataConverters.interfaces.dataformulaobject.intefaces.CellType;
import java.io.Serializable;

/**
 *
 * @author Nobody
 */
public abstract class CommonDefaultCell implements Cell,Serializable, Comparable<CommonDefaultCell> {

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final CommonDefaultCell other = (CommonDefaultCell) obj;
        if (this.column != other.column) {
            return false;
        }
        if (this.row != other.row) {
            return false;
        }
        if (this.cellType != other.cellType && (this.cellType == null || !this.cellType.equals(other.cellType))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        return hash;
    }

    private int column;
    private int row;
    private CellType cellType;

    protected CommonDefaultCell(int column, int row, CellType cellType) {
        this.column = column;
        this.row = row;
        this.cellType = cellType;
    }

    public int getColumn() {
        return column;
    }

    public int getRow() {
        return row;
    }

    public CellType getType() {
        return cellType;
    }

     public int compareTo(CommonDefaultCell o) {
        int xOther = o.column;
        int yOther = o.row;
        if (row != yOther) {
            return row - yOther;
        } else {
            if (column != xOther) {
                return column - xOther;
            }else{
                return 0;
            }
        }
    }
}
